home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / Libraries / VideoToolbox 95.04.18 / Demos / ScrollDemo.c < prev    next >
C/C++ Source or Header  |  1993-07-31  |  2KB  |  71 lines

  1. /* ScrollDemo.c
  2. ScrollDemo works ONLY on the original Apple color video cards, which are no
  3. longer sold by Apple but are available for $90 from Shreve Systems
  4. (800-227-3971). The supported video cards are called "Toby frame buffer card" or
  5. "Mac II High-Resolution Video Card".  ScrollDemo will refuse to run on any other
  6. video card. The scroll speed naturally depends on the video depth, i.e.
  7. bits/pixel.
  8. 10/29/88    dgp    wrote it
  9. 10/17/90    dgp    removed unused variables
  10. 2/16/91        dgp    added check for fpu and color quickdraw
  11. 8/24/91    dgp    Made compatible with THINK C 5.0.
  12. 3/10/92    dgp    include mc68881.h
  13. 8/27/92    dgp    replace SysEnvirons() by Gestalt()
  14. */
  15. #include "VideoToolbox.h"
  16.  
  17. void ScrollDemo(void);
  18.  
  19. void main(void)
  20. {
  21.     Require(gestalt8BitQD);
  22.     ScrollDemo();
  23. }
  24.  
  25. void ScrollDemo(void)
  26. {
  27.     long int x,y;
  28.     int bits=8;
  29.     int slot;
  30.     GDHandle device;
  31.  
  32.     printf("Welcome to ScrollDemo.\n");
  33.     device = GetDeviceList();
  34.     while(device!=NULL){
  35.         if(TestDeviceAttribute(device,screenDevice) &&
  36.             EqualString("\p.Display_Video_Apple_TFB",GDName(device),1,1))break;
  37.         device=GetNextDevice(device);
  38.     }
  39.     if(device==NULL){
  40.         PrintfExit("Sorry, this program only works with the original Apple Macintosh video cards:\n"
  41.             "“Toby frame buffer card” and “Display_Video_Apple_TFB”\n" );
  42.     }
  43.     slot=GetDeviceSlot(device);
  44.  
  45.     /* these calls are just for fun, to show that the calls don't crash */
  46.     SetUpTFB(slot);
  47.     
  48.     SetPriority(7);    /* disable interrupt for smooth scrolling */
  49.  
  50.     /* demonstrate horizontal panning */
  51.     y=0;
  52.     for(x=0; x<=1028; x+=4){
  53.         NewBlankingTFB(slot);
  54.         PanTFB(slot,x);
  55.     }
  56.     ScrollTFB(slot,bits,0,0);
  57.     for(x=0;x<=24;x++)NewBlankingTFB(slot);
  58.     
  59.     /* demonstrate horizontal and vertical panning */
  60.     for(y=0,x=0; y<=256; x+=4, y++){
  61.         NewBlankingTFB(slot);
  62.         ScrollTFB(slot,bits,x,y);
  63.     }
  64.  
  65.     /* restore default values */
  66.     ScrollTFB(slot,bits,0,0);
  67.  
  68.     SetPriority(0);    /* re-enable interrupt to unfreeze mouse */
  69. }
  70.  
  71.